import React, {Component} from 'react'
import { connect } from 'dva';
import styles from './ExamplePage.css';
class ExamplePage extends Component {
  constructor(props) {
    super(props)
    this.state = {
      value: ''
    }
  }

  componentDidMount() {
  }

  removeItem() {
    console.log(this.props)
    this.props.dispatch({
      type: 'example/save',
      payload: { num: 5 }
    })
  }
  render(){
    let { kk } = this.props;
    return (
      <div className={styles.normal}>
        <h1 className={styles.title}>Yay! Welcome to dva!</h1>
        <div className={styles.welcome} />
        <ul className={styles.list}>
          <li>To get started, edit11 +{kk}+<code>src/index.js</code> and save to reload.</li>
          <li><a href="https://github.com/dvajs/dva-docs/blob/master/v1/en-us/getting-started.md">Getting Started</a></li>
          <button onClick={() => this.removeItem()}>增加</button>
        </ul>
      </div>
    );
  }
}

ExamplePage.propTypes = {
};
function mapStateToProps(state) {
  return {
    kk: state.example.kk
  }
}
export default connect(mapStateToProps)(ExamplePage);
